import React,{useState} from 'react'

export default function Manger() {
    let  [title,setTitle] = useState();
    let  [ws,setWS] = useState(new WebSocket("ws://192.168.51.92:8080"))

    let  sendTitle  = ()=>{
        ws.send(JSON.stringify({
            type:2,
            msg:title
        }))
    }
  return (
    <div>
        <input value={title} onChange={(e)=>{
               setTitle(e.target.value); 
        }}/> <button onClick={()=>{
            sendTitle();
        }}>设置标题</button>
        <button onClick={()=>{
            ws.send(JSON.stringify({
                type:3,
                msg:"踢人"
            }))
        }}>踢人</button>
    </div>
  )
}
